package com.gitee.poi.plugin.model;

import com.gitee.poi.plugin.core.write.WriteCellValue;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;

import java.lang.reflect.Field;
import java.util.List;

/**
 * @author wangxin
 * @time 2018/11/5 16:01
 */
public class CellModel {

    private Field field;

    /**
     * 原始对象
     */
    private Object origin;

    /**
     * 预设当前单元格值
     */
    private Object value;

    /**
     * 当前单元格样式，此处沿用由注解获取的单元格样式，
     * 请勿直接更改，可使用{@link CellStyle#cloneStyleFrom},
     * xls请勿设置超过4000样式，建议缓存每种样式，重复使用
     */
    private CellStyle cellStyle;

    private Sheet sheet;

    private int currentRowIndex;

    private List<FieldStyle> fields;

    private int currentCellIndex;

    private Row row;

    private Cell cell;

    private WriteCellValue writeCellValue;

    public CellModel() {
    }

    public CellModel(Field field, Object origin, Object value, CellStyle cellStyle, Sheet sheet, int currentRowIndex,Row row, int currentCellIndex, Cell cell, List<FieldStyle> fields,WriteCellValue writeCellValue) {
        this.field = field;
        this.origin = origin;
        this.value = value;
        this.cellStyle = cellStyle;
        this.sheet = sheet;
        this.currentRowIndex = currentRowIndex;
        this.fields = fields;
        this.currentCellIndex = currentCellIndex;
        this.row = row;
        this.cell = cell;
        this.writeCellValue = writeCellValue;
    }

    public Field getField() {
        return field;
    }

    public Object getOrigin() {
        return origin;
    }

    public Object getValue() {
        return value;
    }

    public CellStyle getCellStyle() {
        return cellStyle;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public void setCellStyle(CellStyle cellStyle) {
        this.cellStyle = cellStyle;
    }

    public void setField(Field field) {
        this.field = field;
    }

    public void setOrigin(Object origin) {
        this.origin = origin;
    }

    public Sheet getSheet() {
        return sheet;
    }

    public void setSheet(Sheet sheet) {
        this.sheet = sheet;
    }

    public int getCurrentRowIndex() {
        return currentRowIndex;
    }

    public void setCurrentRowIndex(int currentRowIndex) {
        this.currentRowIndex = currentRowIndex;
    }

    public List<FieldStyle> getFields() {
        return fields;
    }

    public void setFields(List<FieldStyle> fields) {
        this.fields = fields;
    }

    public int getCurrentCellIndex() {
        return currentCellIndex;
    }

    public void setCurrentCellIndex(int currentCellIndex) {
        this.currentCellIndex = currentCellIndex;
    }

    public Row getRow() {
        return row;
    }

    public void setRow(Row row) {
        this.row = row;
    }

    public Cell getCell() {
        return cell;
    }

    public void setCell(Cell cell) {
        this.cell = cell;
    }

    public WriteCellValue getWriteCellValue() {
        return writeCellValue;
    }

    public void setWriteCellValue(WriteCellValue writeCellValue) {
        this.writeCellValue = writeCellValue;
    }
}
